/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 顶部导航栏样式 */
.user-header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

.logo i {
    color: #4CAF50;
    margin-right: 5px;
}

.search-box {
    display: flex;
    width: 50%;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 30px 0 0 30px;
    font-size: 16px;
}

.search-box button {
    padding: 0 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 0 30px 30px 0;
    cursor: pointer;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 20px;
}

.cart-icon span {
    position: absolute;
    top: -8px;
    right: -10px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.user-dropdown {
    position: relative;
}

.user-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 5px;
    z-index: 1;
}

.dropdown-content a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
}

.dropdown-content a:hover {
    background: #f5f5f5;
}

.dropdown-content a i {
    width: 20px;
    margin-right: 10px;
}

.user-dropdown:hover .dropdown-content {
    display: block;
}

/* 商品展示区 */
.user-container {
    display: flex;
    gap: 20px;
    padding: 20px 0;
}

.category-filter {
    width: 250px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 80px; /* 与顶部导航栏保持距离 */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.category-filter h2 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.category-filter ul {
    list-style: none;
}

.category-filter li {
    padding: 10px 0;
    border-bottom: 1px solid #f9f9f9;
    transition: all 0.2s;
}

.category-filter li a {
    display: block;
    color: #555;
    text-decoration: none;
    transition: color 0.2s;
}

.category-filter li.active {
    background-color: #f0fff4;
    border-left: 4px solid #4CAF50;
    padding-left: 10px;
}

.category-filter li.active a {
    color: #4CAF50;
    font-weight: bold;
}

.category-filter li:hover:not(.active) {
    background-color: #f9f9f9;
}

.category-filter li:hover a {
    color: #4CAF50;
}

.product-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-image {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.no-image {
    font-size: 50px;
    color: #ddd;
}

.product-info {
    padding: 15px;
}

.product-info h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.product-price {
    color: #e74c3c;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.product-stock {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 14px;
}

.add-to-cart {
    width: 100%;
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.add-to-cart:hover {
    background: #45a049;
}

/* 购物车侧边栏 */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: right 0.3s;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-cart {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #777;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f5f5f5;
}

.item-info h4 {
    margin-bottom: 5px;
    font-size: 16px;
}

.remove-item {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 16px;
}

.empty-cart {
    text-align: center;
    padding: 50px 0;
    color: #999;
}

.empty-cart i {
    font-size: 50px;
    margin-bottom: 15px;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #eee;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background: #c0392b;
}

/* 页脚 */
.user-footer {
    background: #333;
    color: #fff;
    padding: 30px 0;
    text-align: center;
    margin-top: 40px;
}

.user-footer .container {
    max-width: 1200px;
    margin: 0 auto;
}

.user-footer p {
    margin: 5px 0;
    color: #ccc;
}

/* 遮罩层（购物车打开时） */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.cart-sidebar.open + .cart-overlay {
    display: block;
}
/* 搜索结果标题样式 */
.search-results-header {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.search-results-header h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.search-results-header p {
    color: #666;
    font-size: 16px;
}